# Copyright (c) 2019 Presto Labs Pte. Ltd.
# Author: donggu

from experimental.prophet.ops import timeseries


def trade_sign_window(trade, window_size):
  sign = (trade.side == 1) - (trade.side == 2)
  window = timeseries.time_moving_window(sign, window_size)
  return window


def trade_sign_sum(trade, window_size):
  return trade_sign_window(trade, window_size).sum()


def trade_sign_mean(trade, window_size):
  return trade_sign_window(trade, window_size).mean()


__all__ = ['trade_sign_window', 'trade_sign_sum', 'trade_sign_mean']
